<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>div1</div>
    <span>span1</span>

    <script>
      const divObj =  document.querySelector("div")
      console.log(divObj.nextSibling)                 //#text
      console.log(divObj.nextElementSibling)        //<span>span1</span>

      console.log(divObj.previousSibling)           //#text
      console.log(divObj.previousElementSibling)    //null  body是父节点
    </script>
</body>
</html>